package cn.iocoder.yudao.server.framework.filter;

import cn.iocoder.yudao.framework.web.config.WebProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Arrays;

/**
 * @author lxc
 * @description:
 * @date 2023/12/12 15:22
 */
@Configuration
public class FilterConfig  implements WebMvcConfigurer {
    @Bean
    FilterRegistrationBean<CheckParamFilter> myFilterFilterRegistrationBean(WebProperties webProperties) {
        FilterRegistrationBean<CheckParamFilter> bean = new FilterRegistrationBean<>();
        bean.setFilter(new CheckParamFilter(webProperties));
        bean.setOrder(-96);
        bean.setUrlPatterns(Arrays.asList("/*"));
        return bean;
    }
}
